package com.jzo2o.foundations.controller.consumer;

import com.jzo2o.common.model.Result;
import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
import com.jzo2o.foundations.service.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Mr.M
 * @version 1.0
 * @description 首页信息查询
 * @date 2024/11/4 15:24
 */
@RestController("consumerServeController")
@RequestMapping("/customer/serve")
@Api(tags = "用户端 - 首页服务查询接口")
public class FirstPageServeController {
    @Resource
    private HomeService homeService;

    @GetMapping("/firstPageServeList")
    @ApiOperation("首页服务列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "regionId", value = "区域id", required = true, dataTypeClass = Long.class)
    })
    public List<ServeCategoryResDTO> serveCategory(@RequestParam("regionId") Long regionId) {
        List<ServeCategoryResDTO> serveCategoryResDTOS1 = homeService.queryServeIconCategoryByRegionIdCache(regionId);
        return serveCategoryResDTOS1;
    }

    /**
     * 区域全部服务类型
      * @param regionId
     * @return
     */
    @GetMapping("/serveTypeList")
    @ApiOperation("服务类型列表")
    public List<ServeCategoryResDTO> serveTypeList(@RequestParam("regionId") Long regionId) {
        List<ServeCategoryResDTO> serveCategoryResDTOS = homeService.serveTypeList(regionId);
        return serveCategoryResDTOS;
    }

    /**
     * 热门服务列表
     */
    @GetMapping("/hotServeList")
    @ApiOperation("热门服务列表")
    public List<ServeAggregationSimpleResDTO> hotServeList(@RequestParam("regionId") Long regionId) {
        List<ServeAggregationSimpleResDTO> serveAggregationSimpleResDTOS = homeService.hotServeList(regionId);
        return serveAggregationSimpleResDTOS;
    }

    /**
     * 服务详情
     */
    @GetMapping("/{id}")
    @ApiOperation("服务详情")
    public ServeAggregationSimpleResDTO serveDetail(@PathVariable("id") Long serveId) {
        ServeAggregationSimpleResDTO serveAggregationSimpleResDTO = homeService.serveDetail(serveId);
        return serveAggregationSimpleResDTO;

    }
}
